﻿function Audio(options) {
    this.options = options;
}
Audio.prototype = {
    TagetElement: null,
    init: function () {
        var audioElement = document.createElement("audio");
        audioElement.setAttribute("id", this.options["id"]);
        var a = "";
        if (typeof this.options["controls"] == "string") {
            audioElement.setAttribute("controls", this.options["controls"]);
        }
        if (typeof this.options["autoplay"] == "string") {
            audioElement.setAttribute("autoplay", this.options["autoplay"]);
        }
        if (typeof this.options["src"] == "string") {
            audioElement.setAttribute("src", this.options["src"]);
        }
        document.getElementById(this.options["tagetElementId"]).appendChild(audioElement);
        this.TagetElement = audioElement;
    },
    load: function () {
        this.TagetElement.load();
    },
    play: function () {
        this.TagetElement.play();
    },
    pause: function () {
        this.TagetElement.pause();
    },
    canPlayType: function (type) {
        this.TagetElement.canPlayType(type);
    }
}